package lk.icta.core.entity;

import lk.icta.common.entity.BaseEntity;
import lk.icta.common.entity.Person;
import lk.icta.user.entity.User;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(schema = "ELAND_RAIL")

@NamedQueries({
        @NamedQuery(name = "getObjectionByApplicationId", query = "SELECT o FROM Objection o WHERE o.applicationId = :applicationId")
})

public class Objection extends BaseEntity {
    /**
     * Details of the person
     */
    @ManyToOne(cascade = {CascadeType.ALL})
    @JoinColumn(nullable = true)
    private Person person;

    @ManyToOne
    @JoinColumn(nullable = true)
    private User user;

    @Column(nullable = false)
    private long applicationId;

    @Column(nullable = false)
    private String objection;

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public long getApplicationId() {
        return applicationId;
    }

    public void setApplicationId(long applicationId) {
        this.applicationId = applicationId;
    }

    public String getObjection() {
        return objection;
    }

    public void setObjection(String objection) {
        this.objection = objection;
    }
}
